package com.project.ServiceImp;


import com.alibaba.dubbo.config.annotation.Service;
import com.project.mapper.NewDoctorDao;
import gz.NewDoctorService;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service(interfaceClass = NewDoctorService.class)
@Component
@Transactional
public class NewDoctorServiceImp implements NewDoctorService{

    @Resource
    private NewDoctorDao nd;


    /**
     * 查询出所有的患者信息
     * @param name
     * @return
     */
    @Override
    public List<Map<String, Object>> findAll(String name) {
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        return nd.findAll(map);
    }


    /**
     * 根据患者id查询一位患者信息
     * @param id
     * @return
     */
    @Override
    public List<Map<String, Object>> getOnePatient(Integer id) {
        Map<String,Object> map = new HashMap<>();
        map.put("patient_id",id);
        return nd.getOnePatient(map);
    }


    /**
     * 查询药品信息
     * @param name
     * @return
     */
    @Override
    public List<Map<String, Object>> ChineseMedicines(String name) {
        Map<String,Object> map = new HashMap<>();
        map.put("name",name);
        return nd.ChineseMedicines(map);
    }


    /**
     * 查询检查项目信息
     * @param name
     * @return
     */
    @Override
    public List<Map<String, Object>> check_project(String name) {
        Map<String,Object> map = new HashMap<>();
        map.put("project_name",name);
        List<Map<String, Object>> all =  nd.check_project(map);
        return all;
    }


    /**
     * 查询附加费用信息
     * @return
     */
    @Override
    public List<Map<String, Object>> additional_cost() {
        return nd.additional_cost();
    }


    /**
     * 查询所有的中药信息
     * @return
     */
    @Override
    public List<Map<String, Object>> all_midecines() {
        return nd.all_Midecines();
    }

    /**
     * 根据传过来的药品id查询信息
     * @param midecines_id
     * @return
     */
    @Override
    public List<Map<String, Object>> select_mid(List<String> midecines_id) {
        return nd.select_mid(midecines_id);
    }

    /**
     * 根据传过来的检查项目id查询信息
     * @param pre_id
     * @return
     */
    @Override
    public List<Map<String, Object>> select_pid(List<String> pre_id) {
        return nd.select_pid(pre_id);
    }

    /**
     * 根据传过来的附加费用id查询信息
     * @param ins_id
     * @return
     */
    @Override
    public List<Map<String, Object>> select_id(List<String> ins_id) {
        return nd.select_id(ins_id);
    }

    /**
     * 查询患者的档案
     * @param id
     * @return
     */
    @Override
    public List<Map<String, Object>> getPatientFile(Integer id) {
        Map<String,Object> map = new HashMap<>();
        map.put("patient_id",id);
        return nd.getPatientFile(map);
    }


    /**
     * 查询患者的历史病历
     * @param id
     * @return
     */
    @Override
    public List<Map<String, Object>> getHistoryFile(Integer id) {
        Map<String,Object> map = new HashMap<>();
        map.put("patient_id",id);
        return nd.getHistoryFile(map);
    }


    /**
     * 保存成功添加信息到历史病历
     * @param map
     * @return
     */
    @Override
    public int insert_history(Map map) {
        return nd.insert_history(map);
    }

    /**
     * 保存成功添加信息到处方列表
     * @param map
     * @return
     */
    @Override
    public int insert_order(Map map) {
        return nd.insert_order(map);
    }


    /**
     * 查询出历史病历的的id
     * @param code
     * @return
     */
    @Override
    public int select_historyId(String code) {
        Map<String,Object> map = new HashMap<>();
        map.put("case_code",code);
        return nd.select_historyId(map);
    }

    /**
     * 修改care_history_id
     * @param id
     * @param code
     * @return
     */
    @Override
    public int update_orderId(Integer id, String code) {
        Map<String,Object> map = new HashMap<>();
        map.put("case_code",code);
        map.put("id",id);
        return nd.update_orderId(map);
    }


    /**
     * 如保存成功则修改患者的状态为已就诊
     * @param id
     * @return
     */
    @Override
    public int update_regisid(Integer id) {
        Map<String,Object> map = new HashMap<>();
        map.put("patient_id",id);
        return nd.update_regisid(map);
    }
}
